<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class SpeechcraftStageNode extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('speechcraft_stage_node', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedBigInteger('speechcraft_id')->default(0)->comment('话术ID');
            $table->unsignedBigInteger('speechcraft_stage_id')->default(0)->comment('流程ID');
            $table->string('name',40)->comment('节点名称');
            $table->string('speech')->nullable()->comment('AI话术');
            $table->string('speech_path')->nullable()->comment('AI话术录音');
            $table->integer('speech_time')->default(0)->comment('AI话术录音时长');
            $table->tinyInteger('type')->default(0)->comment('节点类型：0普通节点，1跳转节点');
            $table->bigInteger('next')->default(0)->comment('仅对type=1时生效，-1挂机，0下一主动流程，1指定主动流程');
            $table->bigInteger('next_stage_id')->default(0)->comment('仅对type=1时生效, 流程ID');
            $table->tinyInteger('enable_break')->default(0)->comment('是否允许打断，0不允许，1允许，默认0');
            $table->tinyInteger('is_entrance')->default(0)->comment('入口节点，0否，1是否，默认0');

            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('speechcraft_stage_node');
    }
}
